exports.MallContainer = GL2.Sprite.subclass(
{
    classname: 'MallContainer',
    
    initialize: function() 
    {
		this._mallUI = null;
		this._size = null;
		this._scale = null;
    },
	
	createView: function()
	{	
		this.setImage("./Content/images/gamelayer/Transparent.png",[this._size.getX(),this._size.getY()], [0,1]);
		//this.setAlpha(0);
		this._scale = new Core.Point(1, 1);
		//this.setColor(1.0,0,0);
		
		//var mallModel = MMGameState.getCurrentUser()._allMalls.objectAtIndex(0);
		//this.loadMallWithModel(mallModel);
	},
	
	loadMallWithModel: function(mallModel)
	{
		this._mallUI = new MallUI(mallModel);
		this._mallUI.createView();
		this.addChild(this._mallUI);
	},
	
	setSize: function(size)
	{
		this._size = size;
	},
	
	getMallUI: function()
	{
		if(this._mallUI)
		{
			return this._mallUI;
		}
		return null;
	},
	
	getSize: function()
	{
		return this._size;
	},
	
	zoomOutView: function()
	{
		this._scale = new Core.Point(0.30, 0.30);
		var position = this.getCenterPositionOfMallForZoomOut();
		this._mallUI.setPosition(position);
		this._mallUI.setScale(this._scale);
	},
	
	getCenterPositionOfMallForZoomOut: function()
	{
		var screenCenter = TCUtil.getScreenWidth()/2;
		var flourCenterZoomedOut = TCUtil.getScreenWidth()*this._scale.getX()/2;
		var positionX = screenCenter - flourCenterZoomedOut;
		return new Core.Point(positionX,0);
	},
	
	zoomInView: function()
	{
		this._scale = new Core.Point(1, 1);
		this._mallUI.setPosition(0,0);
		this._mallUI.setScale(this._scale);
	},
	
	getScale: function()
	{
		return this._scale;
	},
	
	getBaseResourcePath: function()
	{
		return "./Content/images/gamelayer/environmentlayer/";
	},
								   
	destroy: function()
    {
		if(this._mallUI) 
		{
			this._mallUI.destroy();
			this._mallUI = null;
		}
		if(this._scale)
		{
//			this._scale.destroy();
//			this._scale = null;
		}
    },
});
